package com.xz.demo;

import com.xz.demo.model.Concrete1Prototype;
import com.xz.demo.model.ConcretePrototype;
import com.xz.demo.model.Prototype;

/**
 * @author 张志航     
 * @version V1.0.0
 * @projectName design_mode
 * @title     Client   
 * @package    com.xz.demo  
 * @date   2019/11/29 16:37  
 * @explain
 */
public class Client {

    public static void main(String[] args) {
        test1();
        testCloneable();
    }

    // 深克隆
    private static void testCloneable() {
        Concrete1Prototype prototype = new Concrete1Prototype();
        prototype.setAttr("Love");
        Concrete1Prototype prototype1 = prototype.clone();
        System.out.println(prototype == prototype1);
        System.out.println(prototype.getAttr() == prototype1.getAttr());
    }

    private static void test1() {
        ConcretePrototype prototype = new ConcretePrototype();
        prototype.setAttr("Agg");
        ConcretePrototype prototype1 = prototype.clone();
        System.out.println(prototype == prototype1);
        System.out.println(prototype.getAttr() == prototype1.getAttr());
    }

}
